﻿using Basic.FlowGatewayModule.Interface;
using Basic.FlowGatewayModule.Model;
using Basic.FlowRemoteModel.FlowAppMsg.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;

namespace Basic.FlowGatewayModule.Api
{
    [ApiRouteName("/flow/app/msg/{name}")]
    internal class FlowAppMsgApi : ApiController
    {
        private readonly IFlowAppMsgService _Service;

        public FlowAppMsgApi ( IFlowAppMsgService service )
        {
            this._Service = service;
        }

        public FlowAppMsgDto[] Gets ( [NumValidate("flow.app.id.error", 1)] long appId )
        {
            return this._Service.Gets(appId);
        }
        public void Set ( AppMsgSet data )
        {
            this._Service.Set(data.AppId, data.FormId, data.Data);
        }
    }
}
